<?php

namespace common\observer;

use common\service\StepService;
use support\SingletonTrait;
use teamones\dbeventObserver\interfaces\SplObserver;
use teamones\dbeventObserver\interfaces\SplSubject;

/**
 * 监听工序上游配置变化 自动清除查询缓存
 */
class StepUpstreamUpdateRemoveCache implements SplObserver
{
    use SingletonTrait;

    /**
     * @inheritDoc
     */
    function update(SplSubject $subject): void
    {
        $stepUpstream = $subject->getSubjectData();
        StepService::getInstance()->removeStepUpstreamQueryCache($stepUpstream['step_id'], $stepUpstream['project_template_id']);
    }
}
